package com.atguigu.schedule.service.impl;

import com.atguigu.schedule.dao.SysUserDao;
import com.atguigu.schedule.dao.impl.SysUserDaoImpl;
import com.atguigu.schedule.pojo.SysUser;
import com.atguigu.schedule.service.SysUserService;
import com.atguigu.schedule.util.MD5Util;

public class SysUserServiceImpl implements SysUserService {
    private SysUserDao sysUserDao = new SysUserDaoImpl();
    @Override
    public int register(SysUser sysUser) {

        sysUser.setUserPwd(MD5Util.encrypt(sysUser.getUserPwd()));
        //调用dao层

        //int rows = sysUserDao.addSysUser(sysUser);

        return sysUserDao.addSysUser(sysUser);
    }

    @Override
    public SysUser findByUserName(String username) {

        SysUser sysUser = sysUserDao.findByUserName(username);
        return sysUser;
    }
}
